//
//  ViewController.m
//  11104
//
//  Created by student on 16/2/29.
//  Copyright © 2016年 NIIT. All rights reserved.
//

#import "ViewController.h"

@interface ViewController ()


@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view, typically from a nib.
    UIButton *bt1 = [[UIButton alloc] initWithFrame:CGRectMake(20, 10, 60, 30)];
    [bt1 setTitle:@"新闻一" forState:UIControlStateNormal];
    [bt1 setTitleColor:[UIColor redColor] forState:UIControlStateNormal];
    [bt1 setTitleColor:[UIColor greenColor] forState:UIControlStateHighlighted];
    UIButton *bt2 = [[UIButton alloc] initWithFrame:CGRectMake(20+110*1, 10, 60, 30)];
    [bt2 setTitle:@"新闻二" forState:UIControlStateNormal];
    [bt2 setTitleColor:[UIColor redColor] forState:UIControlStateNormal];
    [bt2 setTitleColor:[UIColor greenColor] forState:UIControlStateHighlighted];
    UIButton *bt3 = [[UIButton alloc] initWithFrame:CGRectMake(20+110*2, 10, 60, 30)];
    [bt3 setTitle:@"新闻三" forState:UIControlStateNormal];
    [bt3 setTitleColor:[UIColor redColor] forState:UIControlStateNormal];
    [bt3 setTitleColor:[UIColor greenColor] forState:UIControlStateHighlighted];
    UIButton *bt4 = [[UIButton alloc] initWithFrame:CGRectMake(20+110*3, 10, 60, 30)];
    [bt4 setTitle:@"新闻四" forState:UIControlStateNormal];
    [bt4 setTitleColor:[UIColor redColor] forState:UIControlStateNormal];
    [bt4 setTitleColor:[UIColor greenColor] forState:UIControlStateHighlighted];
    UIButton *bt5 = [[UIButton alloc] initWithFrame:CGRectMake(20+110*4, 10, 60, 30)];
    [bt5 setTitle:@"新闻五" forState:UIControlStateNormal];
    [bt5 setTitleColor:[UIColor redColor] forState:UIControlStateNormal];
    [bt5 setTitleColor:[UIColor greenColor] forState:UIControlStateHighlighted];
    UIButton *bt6 = [[UIButton alloc] initWithFrame:CGRectMake(20+110*5, 10, 60, 30)];
    [bt6 setTitle:@"新闻六" forState:UIControlStateNormal];
    [bt6 setTitleColor:[UIColor redColor] forState:UIControlStateNormal];
    [bt6 setTitleColor:[UIColor greenColor] forState:UIControlStateHighlighted];
    
    UIScrollView *scrollView = [[UIScrollView alloc] initWithFrame:CGRectMake(0, 20, 320, 47)];
    [scrollView addSubview:bt1];
    [scrollView addSubview:bt2];
    [scrollView addSubview:bt3];
    [scrollView addSubview:bt4];
    [scrollView addSubview:bt5];
    [scrollView addSubview:bt6];
    // 1.内容尺寸
    scrollView.contentSize = CGSizeMake(20+110*6,10);
    // 2.隐藏滑动条
    scrollView.showsHorizontalScrollIndicator = NO;
    
    [self.view addSubview:scrollView];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

@end
